﻿using System;
using System.Collections.Generic;
using System.Text;
using Ionic.Zip;
using System.IO;

namespace OpenGameEngine.Helper
{
    public class Zip
    {
        private ZipFile content;

        public Zip(String path)
        {
            if (!File.Exists(path))
                throw new FileNotFoundException("Unable to find the content file", path);

            content = new ZipFile(path);
            content.ZipErrorAction = ZipErrorAction.Throw;

        }

        public MemoryStream Extract(String path)
        {
                MemoryStream stream = new MemoryStream();
                content[path].Extract(stream);
                stream.Position = 0;
                return stream;
        }
    }
}
